/* 
    堆栈路由
 */
import {createNativeStackNavigator} from '@react-navigation/native-stack';
const Stack = createNativeStackNavigator();

export default function NavigatorStack({routes,initialRouteName,headerShown}) {
  try{
    return (
      <Stack.Navigator initialRouteName={initialRouteName?initialRouteName:routes[0].name}>
        {routes.map((route, index) => (
          <Stack.Screen
            key={index}
            {...route}
            options={{headerShown: headerShown?headerShown:false}}
          />
        ))}
      </Stack.Navigator>
    )
  }catch(e){
    console.log('堆栈路由',e);
  }
}